#include <iostream>
#include "serviceview_console_impl.h"
#include "service_impl.h"
#include "getch.h"

ServiceViewConsoleImpl::ServiceViewConsoleImpl()
{
	home = new ServiceImpl;
}
void ServiceViewConsoleImpl::menu(void)
{
	while(1)
	{
		system("clear");
		cout << "1.添加部门" << endl;
		cout << "2.删除部门" << endl;
		cout << "3.列出部门" << endl;
		cout << "4.添加员工" << endl;
		cout << "5.删除员工" << endl;
		cout << "6.修改信息" << endl;
		cout << "7.列出员工" << endl;
		cout << "8.列出所有员工" << endl;
		cout << "q.退出" << endl;
		cout << "请输入相应的指令：" << endl;
		char ch = getch();
		switch(ch)
		{
			case '1':addDept();break;			
			case '2':deleteDept();break;			
			case '3':listDept();break;			
			case '4':addEmp();break;			
			case '5':deleteEmp();break;			
			case '6':modifyEmp();break;			
			case '7':listEmp();break;			
			case '8':listAllEmp();break;			
			case 'q':return;			
		}
	}
}

void ServiceViewConsoleImpl::addDept(void)
{
	home->addDept();
}

void ServiceViewConsoleImpl::deleteDept(void)
{
	home->deleteDept();
	
}

void ServiceViewConsoleImpl::listDept(void)
{
	
	home->listDept();
}

void ServiceViewConsoleImpl::addEmp(void)
{
	home->addEmp();	
}

void ServiceViewConsoleImpl::deleteEmp(void)
{
	home->deleteEmp();
}

void ServiceViewConsoleImpl::modifyEmp(void)
{
	home->modifyEmp();
}

void ServiceViewConsoleImpl::listEmp(void)
{
	home->listEmp();
}

void ServiceViewConsoleImpl::listAllEmp(void)
{
	home->listAllEmp();
}


